package com.example.interceptor.controller;

import cn.hutool.extra.spring.SpringUtil;
import com.example.interceptor.custom_method_interceptor.annotation.LhwInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description 自定义方法拦截器测试
 * @Author lihw
 * @Date 2023/12/5 10:55
 */
@Slf4j
@RestController
@RequestMapping("/custom/method")
public class CustomMethodInterceptorController {

    /**
     * 普通拦截器测试
     */
    @GetMapping("test")
    @LhwInterceptor
    public void test() {
        log.info("test method");
        CustomMethodInterceptorController bean = SpringUtil.getBean(this.getClass());
        bean.deal();
    }

    @LhwInterceptor
    public void deal() {
        log.info("deal method");
    }


}
